const configUrl = {
  // 上海证券交易所
  shanghaiURL: 'http://yunhq.sse.com.cn:32041//v1/sh1/snap/',
  dongfangcaifuURL: 'http://80.push2his.eastmoney.com/api/qt/stock/kline/get?'
}

// 东方财富缺省字段
const dongfangcaifuParams = {
  ut: 'fa5fd1943c7b386f172d6893dbfba10b',
  fields1: 'f1%2Cf2%2Cf3%2Cf4%2Cf5%2Cf6',
  fields2: 'f51%2Cf52%2Cf53%2Cf54%2Cf55%2Cf56%2Cf57%2Cf58%2Cf59%2Cf60%2Cf61',
  klt: '101',
  fqt: 0,
  end: 20500101,
  lmt: 1000000,
  _: 1613752430999
}

// 构造东方财富URL
const getDongfangcaifuUrl = (id) => {
  const {
    ut,
    fields1,
    fields2,
    klt,
    fqt,
    end,
    lmt
  } = dongfangcaifuParams;
  const Url = `${configUrl.dongfangcaifuURL}secid=1.${id}&ut=${ut}&fields1=${fields1}&fields2=${fields2}&klt=${klt}&fqt=${fqt}&end=${end}&lmt=${lmt}&_=${new Date().getTime()}`;
  return Url;
}

// 构造上海证券交易所URL
const getShanghaiUrl = (id) => {
  const Url = `${configUrl.shanghaiURL}${id}`;
  return Url;
}

export {
  getDongfangcaifuUrl,
  getShanghaiUrl
}